package lambda_expression.stream;

import lambda_expression.method_reference.Employee;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.function.Function;

public class SkipStreamTest {

    public static void main(String[] args) {
        List<Employee> employeeList = new ArrayList<Employee>();
        employeeList.add(new Employee(1, "ABC", 100, 1120.0));
        employeeList.add(new Employee(2, "DEF", 200, 220.0));
        employeeList.add(new Employee(3, "QWE", 300, 330.0));
        employeeList.add(new Employee(4, "RTY", 400, 10.0));
        employeeList.add(new Employee(4, "POI", 200, 10.0));
        employeeList.add(new Employee(4, "UYT", 300, 10.0));

        Function<Employee, Employee> fn = Function.identity();
        employeeList.stream()
                .sorted(Comparator.comparing(Employee::getAge))
                .skip(3) // 跳过前三条记录
                .forEach(item -> {
                    System.out.println(item);
                });

    }
}
